import service from '@/utils/request'

export const useUserInfoApi = (dataForm: any) => {
	return service.get('/sys/user/info?orgId=' + dataForm.orgId)
}

export const updatePasswordApi = (data: any) => {
	return service.put('/sys/user/password', data)
}

export const resetPasswordApi = (data: any) => {
	return service.put('/sys/user/reset', data)
}

export const useUserApi = (id: number) => {
	return service.get('/sys/user/' + id)
}

export const useUserSubmitApi = (dataForm: any) => {
	if (dataForm.id) {
		return service.put('/sys/user', dataForm)
	} else {
		return service.post('/sys/user', dataForm)
	}
}

export const listAllUserApi = () => {
	return service.get('/sys/user/list-all')
}

export const listUserApi = () => {
	return service.get('/sys/user/list-users')
}

export const editUserUrl = (data: any) => {
	return service.post(`/sys/user/avatar?avatar=${data}`, {})
}

// 手动同步列表
export const getSynsUserInfoList = (dataForm: any) => {
	return service({
	  url: '/sys/user/sync-user-info-list',
	  method: 'get',
	  params: dataForm
	})
}
export const SynsUserInfo = (dataForm: any) => {
	return service({
	  url: '/sys/user/sync-user-info',
	  method: 'get',
	  params: dataForm
	})
}